/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 100;

int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int pi = 1;
    int sum = 0;
    for (int i = 1; i <= n; ++i) {
      int x;
      cin >> x;
      sum += x;
      pi *= x;
    }

    if (sum >= 0 && pi == 1) {
      cout << 0;
    } else if (sum < 0) {
      pi *= ((-(sum - 1)) / 2) % 2 ? -1 : 1;
      if (pi == -1) {
        cout << ((-(sum - 1)) / 2) + 1;
      } else {
        cout << ((-(sum - 1)) / 2);
      }
    } else {
      cout << 1;
    }
    cout << endl;
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("A. Unit Array.in", "r", stdin);
  freopen("A. Unit Array.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
